Xbasic

ADD_BUS_DAYS Function

Syntax

Ending_Date as D = Add_bus_days(D startDate ,N AddDays [,C flag [,C holidayTable ]])

Arguments

Ending_Date

The resulting date.

startDate

The starting date to which you will add business days.

AddDays

A positive or negative number ( not zero). The number of business days to add or subtract. The function does not count weekend days.

flag

Optional. Default = "". If Ignore_Holiday_Flag is any non-null value, the function subtracts holidays from the number of non-weekend days.

holidayTable

Optional. Default = "a_holidays.dbf". If Ignore_Holiday_Flag is "yes", the function uses the list of holidays is supplied in Holiday_Table. If Holiday_Table is blank, then Alpha Anywhere uses the "a_holidays.dbf" table which is contained in the Alpha Anywhere program folder. The holidays in the "a_holidays.dbf" table are defined in the Settings dialog box, accessed with the View > Settings > System > Holidays command from the Alpha Anywhere menus.

Description

ADD_BUS_DAYS() returns an Ending_Date equal to Starting_Date plus Add_Days number of business days.

Adds business days to a date, ignoring weekends. AddDays can be positive or negative. If flag is "yes", then holidays are also ignored. If holidayTable is not specified, then default holiday table (see View/Settings) is used. To use a SQL datasource, 'holidayTable' can be a JSON string with these properties: connectionString, table, column. e.g. {connectionString: 'northwind', table: 'holidays', column: 'dates'}

Example

? {7/12/2002} + 1
= {7/13/2002}
? add_bus_days({7/12/2002}, 1)
= {07/15/2002}

See Also